<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page import="com.gp.api.jsp.MxServerComponent"%>
<%@ page import="com.gp.api.jsp.MxChartDescription"%>
<%@ page import="com.gp.api.model.MxStandardChartModel"%>
<s:include value="banner.jsp" />
<s:include value="menu_cmn.jsp" />
<html>
<script src="/GenReqWorkLoad/js/jquery.min.js"></script>
<script src="/GenReqWorkLoad/js/jquery.maskedinput-1.3.min.js"></script>
<script src="/GenReqWorkLoad/js/jquery.datePicker.js"></script>
<style type="text/css">
@import "css/jquery.datepick.css";
</style>
<script>
    function isNumber(n) {
	  return !isNaN(parseFloat(n)) && isFinite(n);
	}
	
	$(document).ready(
			function() {
				$('#saveIcn_icn').blur(					   
						function() {							
							var x = jQuery('#saveIcn_icn')
									.val();
							var y = x;
							if (isNaN(x.charAt(0))) {
								$("#saveIcn_timesNo").val(
										y.substring(0, x.length - 1));
							} else {
								$("#saveIcn_timesNo").val(
										y.substring(1, x.length));
							}
						});
				$('#saveIcn_budget').blur(					   
						function() {							
							var x = jQuery('#saveIcn_budget')
									.val();
							var y = x;
							$("#saveIcn_planHrs").val("");
							if(x != "") {
							    if(isNumber(x)) {
							    	$("#saveIcn_planHrs").val(Math.round(x/114.29));
							    }
							} 
						});
				jQuery(function($) {
					$("#saveIcn_orderDate").mask("99/99/9999");
					$("#saveIcn_requestDate").mask("99/99/9999");
					$("#saveIcn_outageDate").mask("99/99/9999");
					$("#saveIcn_endDate").mask("99/99/9999");	
					$("#saveIcn_milstnDate").mask("99/99/9999");				
				});

				$(function() {
					$("#saveIcn_orderDate").datepicker();

				});

				
			});
	function formValidate(form){
		var valid = 1;
 		
		$(form).find(":input").each(function(){			
			var $this = $(this);			
			if($this.hasClass("required")){				
				if($this.val() == ""){					
					valid = 0;
					alert("Please enter a value in " + $this.attr("name"));					
				}
			}
		});
		if(valid == 0){
			return false;
		}else{
			return true;
		}
	}
</script>
<head>
<link href="<s:url value="/resources/forms.css"/>" rel="stylesheet" type="text/css" />
<link href="<s:url value="/resources/main.css"/>" rel="stylesheet" type="text/css" />
<link href="<s:url value="/resources/jquery.datepick.css"/>" rel="stylesheet" type="text/css" />
<s:head />
</head>
<body>
<center>
<div class="errors" align="left"><s:actionerror /> <s:actionmessage /></div>
<fieldset style="border: 5px ridge black; width: 800px; height: 910px;"><s:form action="saveIcn" theme="pda">
	<table style="background: #4C787E;">
		<tbody>
			<tr>
				<td class="alt1" width="100%" align="center">
				<h1><s:if test="icn == null">
					<s:text name="label.icn.add" />
				</s:if> <s:else>
					<s:text name="label.icn.edit" />
				</s:else></h1>
				</td>
			</tr>
		</tbody>
	</table>
	<s:hidden name="addFlag" />
	<s:hidden name="btnType" />
	<fieldset><legend style="width: 30%; font-family: Verdana, Arial, Helvetica, sans-serif; border: 1px solid #004000; background: #4C787E; color: #000000; padding: 0 20px;">PROJECT
	INFORMATION</legend>
	<dl>
		<dt class="tdLabel"><s:text name="label.icn" /></dt>
		<dd><s:textfield name="icn" cssClass="required" /><em>*Required</em></dd>
		<dt class="tdLabel"><s:text name="label.scndicn" /></dt>
		<dd><s:textfield name="icn2nd" size="30" /></dd>
	</dl>
	<dl>
		<dt class="tdLabel"><s:text name="label.customer" /></dt>
		<dd><s:textfield name="customer" size="112" /></dd>
	</dl>
	<dl>
		<dt class="tdLabel"><s:text name="label.station" /></dt>
		<dd><s:textfield name="station" size="112" /></dd>
	</dl>
	<dl>
		<dt class="tdLabel"><s:text name="label.genSn" /></dt>
		<dd><s:textfield name="genSn" size="30" /></dd>
		<dt class="tdLabel"><s:text name="label.times" /></dt>
		<dd><s:textfield name="timesNo" size="30" /></dd>
	</dl>
	</fieldset>
	<fieldset><legend style="width: 30%; font-family: Verdana, Arial, Helvetica, sans-serif; border: 1px solid #004000; background: #4C787E; color: #000000; padding: 0 20px;">PROJECT
	TEAM</legend>
	<dl>
		<dt class="tdLabel"><s:text name="label.reqEng" /></dt>
		<dd><s:select list="reqEngMap" name="reqEng" /></dd>
		<dt class="tdLabel"><s:text name="label.pm" /></dt>
		<dd><s:textfield name="pm" size="30" /></dd>
	</dl>
	<dl>
		<dt class="tdLabel"><s:text name="label.ee" /></dt>
		<dd><s:textfield name="ee" size="30" /></dd>
		<dt class="tdLabel"><s:text name="label.me" /></dt>
		<dd><s:textfield name="me" size="30" /></dd>
	</dl>
	<dl>
		<dt class="tdLabel"><s:text name="label.designer" /></dt>
		<dd><s:textfield name="des" size="30" /></dd>
	</dl>
	</fieldset>
	<fieldset style="width: 660px; font-family: Verdana, Arial, Helvetica, sans-serif; border: 1px solid #004000; background: #F5F9F0; color: #000000;"><legend
		style="width: 30%; font-family: Verdana, Arial, Helvetica, sans-serif; border: 1px solid #004000; background: #4C787E; color: #000000;">PROJECT DATES</legend>
	<dl>
		<dt class="tdLabel"><s:text name="label.ordrDt" /></dt>
		<dd><s:textfield name="orderDate" size="20" cssClass="required" /></dd>
		<dt class="tdLabel"><s:text name="label.reqDt" /></dt>
		<dd><s:textfield name="requestDate" size="20" cssClass="required" /></dd>
	</dl>
	<dl>
		<dt class="tdLabel"></dt>
		<dd><span class="mandatory-text">*When Job was Accepted?</span></dd>
		<dt class="tdLabel"></dt>
		<dd><span class="mandatory-text">*When Eng is Needed?</span></dd>
	</dl>
	<dl>
		<dt class="tdLabel"><s:text name="label.outDt" /></dt>
		<dd><s:textfield name="outageDate" size="20" /></dd>
		<dt class="tdLabel"><s:text name="label.orderInfo.endDate" /></dt>
		<dd><s:textfield name="endDate" size="20" cssClass="required" /></dd>
	</dl>
	<dl>
		<dt class="tdLabel"><s:text name="label.orderInfo.milstnDate" /></dt>
		<dd><s:textfield name="milstnDate" size="20" /></dd>
	</dl>
	</fieldset>
	<fieldset class="threeColumnLayout"><legend
		style="width: 30%; font-family: Verdana, Arial, Helvetica, sans-serif; border: 1px solid #004000; background: #4C787E; color: #000000; padding: 0 20px;">PROJECT SCOPE</legend>
	<dl>
		<dt></dt>
		<dd class="tdLabel"><s:text name="Main Scope 1" /></dd>
		<dt></dt>
		<dd></dd>
		<dt style="width: 100px;" class="tdLabel"><s:text name="Main Scope 2" /></dt>
		<dd></dd>
	</dl>
	<dl>
		<dt class="tdLabel"></dt>
		<dd><s:select list="descrMap" name="mainWorkScope1" cssClass="required" /></dd>
		<dt></dt>
		<dd></dd>
		<dt><s:select list="descrMap" name=" " cssClass="required" /></dt>
		<dd></dd>
	</dl>
	<dl>
		<!-- <dt  class="tdLabel"><s:text name="Additional Scope" /></dt> -->
		<s:checkboxlist label="Additional Scope" name="selectedChoices" list="%{addlnList}" listKey="key" listValue="displayName" value="%{selectedAddlnList}" cssClass="AnyClass" cssStyle="square"/>
	</dl>
	<dl>
		<dt class="tdLabel"><s:text name="NOTES" /></dt>
		<dd><s:textfield name="notes" size="100" /></dd>
	</dl>
	</fieldset>
	<fieldset>
	<dl>
		<dt class="tdLabel"><s:text name="label.stat" /></dt>
		<dd><s:select list="statusMap" name="status" cssClass="required" /></dd>
		<dt class="tdLabel"><s:text name="label.orderInfo.ctgryTyp" /></dt>
		<dd><s:select list="ctgryMap" name="ctgryTyp" cssClass="required" /></dd>
	</dl>
	<dl>
		<dt class="tdLabel"><s:text name="label.orderInfo.budget" /></dt>
		<dd><s:textfield name="budget" size="20" /></dd>
		<dt class="tdLabel"><s:text name="label.orderInfo.planHrs" /></dt>
		<dd><s:textfield name="planHrs" size="20" /></dd>
	</dl>
	</fieldset>
	<fieldset>
	<dl>
		<dt></dt>
		<dd><s:submit name="submit" key="button.label.submit" cssClass="butStnd"/></dd>
		<dt></dt>
		<dd><s:submit action="search" value="Cancel" onclick="form.onsubmit=null" cssClass="butStnd" /></dd>
	</dl>
	</fieldset>
</s:form></fieldset>
</center>
<hr>
<fieldset>
<%
	String imageSream = (String) request.getSession(true).getAttribute(
			"imageSream");
	out.write(imageSream);
%>
</fieldset>
</body>

<script type="text/javascript">
	$(document).ready(function () {
		$(':checkbox[name = "selectedChoices"]').click(function (e) {
			if($(':checkbox[name = "selectedChoices"]:checked').length > 4){
				alert("Cannot select more than 4 Addiational Scopes.");
				e.preventDefault();
			}
		});
	});
</script>
</html>